package com.shuwen.gcdj.controller.statistics;

import com.shuwen.gcdj.bean.Home.response.HomeAnimationSensorResp;
import com.shuwen.gcdj.bean.Home.response.HomeStatusSensorResp;
import com.shuwen.gcdj.bean.Home.request.HomeStatusReq;
import com.shuwen.gcdj.bean.Home.response.OverlookingHomeResp;
import com.shuwen.gcdj.bean.basicsEquitment.response.EquipmentExternalLinksResp;
import com.shuwen.gcdj.bean.basicsEquitment.response.EquipmentResp;
import com.shuwen.gcdj.common.annotation.JWTAuth;
import com.shuwen.gcdj.common.api.CommonResult;
import com.shuwen.gcdj.controller.AuthController;
import com.shuwen.gcdj.service.statistic.HomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @author XYC
 */
@Api(tags = "首页统计信息")
@RestController
@RequestMapping("/home")
@Slf4j
public class HomeController extends AuthController {

    @Autowired
    private HomeService homeService;


    @ApiOperation(value = "首页传感器实时数据（应变传感器）")
    @PostMapping(value = "/getStrainAsync")
    public CommonResult<List<HomeStatusSensorResp>> getStrainAsync(@RequestBody @Valid HomeStatusReq req){

        return homeService.getStrainAsync(req);
    };



    @ApiOperation(value = "首页传感器实时数据（振动传感器）")
    @PostMapping(value = "/getVibrationRealTimeDataSensorAsync")
    @JWTAuth
    public CommonResult<List<HomeStatusSensorResp>> getVibrationRealTimeDataSensorAsync(@RequestBody @Valid HomeStatusReq req){
        return homeService.getVibrationRealTimeDataSensorAsync(req);
    };



    @ApiOperation(value = "首页实时动画")
    @PostMapping(value = "/getHomeAnimationSensorAsync")
    @JWTAuth
    public CommonResult<List<HomeAnimationSensorResp>> getHomeAnimationSensorAsync(@RequestBody @Valid HomeStatusReq req){
        return homeService.getHomeAnimationSensorAsync(req);
    };


//    @ApiOperation(value = "俯视首页大图")
//    @PostMapping(value = "/getOverlookingHome")
//    @JWTAuth
//    public CommonResult<List<OverlookingHomeResp>>getOverlookingHome(){
//        return CommonResult.success(homeService.getOverlookingHome());
//    };

    @ApiOperation(value = "设备信息")
    @GetMapping(value = "/getEquipmentCode/{equipmentValue}")
    @JWTAuth
    public CommonResult<EquipmentResp> getEquipmentCode(@ApiParam(value = "设备Value不能为空") @PathVariable Integer equipmentValue){
        return CommonResult.success(homeService.getEquipmentCode(equipmentValue));
    }

    @ApiOperation(value = "外部连接信息")
    @GetMapping(value = "/getOverallScene")
    @JWTAuth
    public CommonResult<EquipmentExternalLinksResp> getOverallScene(){
        return  CommonResult.success(homeService.getOverallScene());
    }
/*    @ApiOperation(value = "查询长连接地址")
    @PostMapping(value = "/getWebSocketConnect/req")
    public CommonResult<List<SysDictionaryResp>> getWebSocketConnect(@RequestBody HomeStatusReq req){
        return CommonResult.success(homeService.getWebSocketConnect(req));
    };*/
}
